<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/


/*Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/

// xxming:认证
/*Route::namespace('Api')->group(function () {
    Route::post('login', 'LoginController@login');
}); # 登录路由

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/


Route::get('/test', 'TestController@index');

Route::group(['prefix' => 'swagger'], function () {
    Route::get('json', 'SwaggerController@getJSON');
});

$api = app('Dingo\Api\Routing\Router');
$api->version('admin', function ($api) {
    $api->get('/admin/articles', 'App\Http\Controllers\Admin\ArticleController@index');
    $api->put('/admin/articles/{articleId}', 'App\Http\Controllers\Admin\ArticleController@update');
    $api->get('/admin/articles/{articleId}', 'App\Http\Controllers\Admin\ArticleController@show');
});